package com.qqtop10.manager.controller;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.qqtop10.manager.model.CusCons;
import com.qqtop10.manager.model.PagingArgs;
import com.qqtop10.manager.model.Result;
import com.qqtop10.manager.model.Role;
import com.qqtop10.manager.model.Shop;
import com.qqtop10.manager.model.User;
import com.qqtop10.manager.service.UserService;
import com.qqtop10.manager.service.WalletService;

@RequestMapping("/manager/coustomerflow/")
@Controller
public class WalletController extends BaseController{
	@Autowired
	private WalletService walletService;

	@RequestMapping("all.do")
	@ResponseBody
	public Result all(CusCons input) {
		//System.out.println("test");
		try {
			PagingArgs pagingArgs = getPagingArgs();
			int count = walletService.count(input);
			List<CusCons> array = walletService.all(input, pagingArgs);
			return page(count, array);
		} catch (Exception e) {
			return excep(e);
		}
	}
	@RequestMapping("selectById.do")
	@ResponseBody
	public Result selectById(CusCons input){
		try {
			input.setAccount(URLDecoder.decode(input.getAccount(),"UTF-8"));
			//input.setUsername(URLDecoder.decode(input.getUsername(),"UTF-8"));
		} catch (UnsupportedEncodingException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		//System.out.println(input.getAccount());
		try {
			PagingArgs pagingArgs = getPagingArgs();
			int count = walletService.count(input);
			List<CusCons> array = walletService.selectById(input,pagingArgs);
			return page(count, array);
		} catch (Exception e) {
			return excep(e);
		}
	}
}
